<?php

class Zendvn_View_Helper_CmsCk extends Zend_View_Helper_Abstract
{
	/*
	 * $config = array();
	 * $config['toolbar'] 
	 * $config['language'] 
	 * $config['width'] 
	 * $config['height'] 
	 */
	
	/*
	 * $options['ProcessHTMLEntities']
	 * $options['ProcessNumericEntities'] 
	 */
	public function cmsCk($name, $value = null, $config = array(), $events = array()){
		require_once(PUBLIC_PATH . '/scripts/ckeditor/ckeditor.php');

		$ckEditor->basePath = PUBLIC_URL . '/scripts/ckeditor/';
		
		$ckEditor = new CKEditor();
		
		if(isset($config['width'])){
			$ckEditor->config['width'] = $config['width'];
		}
		
		if(isset($config['height'])){
			$ckEditor->config['height'] = $config['height'];
		}
		
		if($config['toolbar'] != null ){
			$ckEditor->ToolbarSet = $config['toolbar'];
		}
		
		if(isset($config['language'])){
			$ckEditor->Config['AutoDetectLanguage'] = false;
			$ckEditor->Config['DefaultLanguage'] = $config['language'];
		}
		
		$ckEditor->editor($name, $value, $config, $events);
	}
}
